<html>
<head>
<script type="text/javascript" src="jquery-1.4.2.js"></script>
<script src="jquery-json-2.2.js"></script>
<script>

  /**
   * simple client for putio api
   */
  var API_SERVER = 'http://api.put.io/v1/';
  var secret  = '#API_SECRET#';
  var api_key = '#API_KEY#';


  $(document).ready(function(){

    var url = API_SERVER + 'files/?method=list';

    var r = {'api_secret': secret, "api_key": api_key, "params":{"id":0, "limit":10, "offset":0}}
    
    url = API_SERVER + 'files/?method=list&request='+$.toJSON(r)+'&callback=?';

    $.getJSON(url, function(data){

        items = data.response.results;

        $.each(items, function(i,item){

          $('#heading').hide();

          $('#items')[0].innerHTML += '<li> <img src="'+ (item.thumb_url ?  item.thumb_url : item.file_icon_url) +'">' +
                                      '<a href="'+item.stream_url+'">' +
                                       item.name
                                       '</a>' +
                                        +'</li>';
        });
    });
  });




</script>
</head>
<body >
  <div id="content">
    <span id="heading" class="heading">loading..</span>

    <ul id="items"></ul>

  </div>
</body>
</html>